package com.example.myapplication.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;

import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;

/**
 * Path
 * 作者：李祥
 * 邮箱：499194689@qq.com
 */

public class TestView06 extends View {




    float mH;
    float mW;
    Paint paint = new Paint();

    public TestView06(Context context) {
        super(context);
    }

    public TestView06(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);
        mH = h;
        mW = w;
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.translate( mW / 2, +mH / 2);

//        Path path = new Path();
//        path.lineTo(100, 100);
//        path.lineTo(100, 0);
//        path.close();
//        paint.setStyle(Paint.Style.STROKE);
//        paint.setStrokeWidth(5);
//        canvas.drawPath(path, paint);

      //  canvas.scale(1,-1);
        Path path1 = new Path();
       // path1.lineTo(100,100);
        RectF oval = new RectF(0,0,200,200);

        path1.addArc(oval,0,100);
        canvas.drawPath(path1,paint);

    }
}
